<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>Messgae is:</h2>
    <input type="text" id="user" autocomplete="off" placeholder="请输入账号">

    <hr>
    <select id="sele">
        <option>北京市</option>
        <option>上海市</option>
        <option>重庆市</option>
        <option>天津市</option>
    </select>
    <h2>选择的省份: <span id="seleText"></span></h2>

    <script>
        let h2Ele = document.querySelector('h2');
        let userEle = document.getElementById('user');
        let seleEle = document.getElementById('sele');
        let seleTextEle = document.getElementById('seleText');

        // 输入框的事件
        userEle.addEventListener('input', function () {
            h2Ele.innerHTML = 'Messgae is:  ' + this.value;
        });

        // 下拉框的事件
        seleEle.addEventListener('change', function () {
            console.log(this.value)
            seleTextEle.innerText = this.value;
        });


    </script>
</body>

</html>